/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.urbansoft.icl.record;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.urbansoft.icl.field.Field;
import org.urbansoft.icl.field.GenericANField;
import org.urbansoft.icl.field.Position;
import org.urbansoft.icl.field.validation.RecordTypeValidator;

/**
 * 
 * @author Ricardo Reyes
 */
public class ReturnRecord extends Record {
	public Field recordType;
	public Field payorBankRoutingNumber;
	public Field payorBankRoutingNumberCheckDigit;
	public Field onUs;
	public Field itemAmount;
	public Field returnReason;
	public Field returnRecordAddendumCount;
	public Field returnDocumentationTypeInd;
	public Field forwardBundleDate;
	public Field eceInstitutionItemSequenceNumber;
	public Field taxAmount;
	public Field chileanExpandedReturnReason;

	static Logger log = Logger.getLogger(CheckDetailRecord.class);

	/**
	 * Instantiates a new check detail record.
	 */
	public ReturnRecord() {
		fields = new ArrayList<Field>();
		recordName = "Return Record";
		recordTypeNumber = "31";
		initFields();
	}

	/**
	 * Inits the fields.
	 */
	private void initFields() {
		try {
			/* check detail record */
			recordType = new GenericANField(new Position(1, 2),
					RecordTypeValidator.INSTANCE, "31", "Record Type");
			payorBankRoutingNumber = new GenericANField(new Position(3, 10),
					"Auxiliary On Us");
			payorBankRoutingNumber.setFieldData("");
			payorBankRoutingNumberCheckDigit = new GenericANField(new Position(
					11, 11), "Payor Bank Routing Number Check Digit");
			payorBankRoutingNumberCheckDigit.setFieldData("");
			onUs = new GenericANField(new Position(12, 31), "On Us");
			onUs.setFieldData("");
			itemAmount = new GenericANField(new Position(32, 46), "Item Amount");
			itemAmount.setFieldData("");
			returnReason = new GenericANField(new Position(47, 47),
					"Return Reason");
			returnReason.setFieldData("");
			returnRecordAddendumCount = new GenericANField(
					new Position(48, 49), "Return Record Addendum Count");
			returnRecordAddendumCount.setFieldData("");
			returnDocumentationTypeInd = new GenericANField(
					new Position(50, 50), "Return Documentation Type Indicator");
			returnDocumentationTypeInd.setFieldData("");
			forwardBundleDate = new GenericANField(new Position(51, 58),
					"Forward Bundle Date");
			forwardBundleDate.setFieldData("");
			eceInstitutionItemSequenceNumber = new GenericANField(new Position(
					59, 73), "Ece Institution Item Sequence Number");
			eceInstitutionItemSequenceNumber.setFieldData("000000000000000");
			taxAmount = new GenericANField(new Position(74, 79), "Tax Amount");
			taxAmount.setFieldData("");
			chileanExpandedReturnReason = new GenericANField(new Position(80,
					90), "Chilean Expanded Return  Reason");
			chileanExpandedReturnReason.setFieldData("");

			fields.add(recordType);
			fields.add(payorBankRoutingNumber);
			fields.add(payorBankRoutingNumberCheckDigit);
			fields.add(onUs);
			fields.add(itemAmount);
			fields.add(returnReason);
			fields.add(returnRecordAddendumCount);
			fields.add(returnDocumentationTypeInd);
			fields.add(forwardBundleDate);
			fields.add(eceInstitutionItemSequenceNumber);
			fields.add(taxAmount);
			fields.add(chileanExpandedReturnReason);

		} catch (Exception e) {
			log.fatal(e.getMessage(), e);
		}
	}

}
